package com.fjh.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fjh.domain.SysMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SysMenuMapper extends BaseMapper<SysMenu> {
    /**
     * 查询用户菜单
     * @param userId
     * @return
     */
    @Select("SELECT t1.* FROM `sys_menu` AS t1 join sys_role_menu AS t2 on(t1.menu_id=t2.menu_id) join sys_user_role as t3 on(t2.role_id=t3.role_id) where t3.user_id = #{value} and (t1.type = 0 or t1.type = 1) order by t1.order_num desc")
    List<SysMenu> findUserMenu(String userId);
}